﻿CREATE FUNCTION [dbo].[fn_ColumnsAll]
(
	@Table sysname
)
RETURNS TABLE
AS
	RETURN (
	    SELECT c.[name] AS [ColumnName]
	    FROM   sys.tables t
	           INNER JOIN sys.[columns] c
	                ON  t.[object_id] = c.[object_id]
	    WHERE  t.[name] = @Table
		       AND t.[type] = 'U'
	)